package com.ginmeta.domain.system.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 系统用户表
 * @author GinMeta
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Accessors(chain = true)
@Table("sys_user")
public class SysUser implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
    * 用户id
    */
    @Id(keyType = KeyType.Auto)
    private Long userId;

    /**
    * 用户名
    */
    private String username;

    /**
    * 密码
    */
    @JsonIgnore
    private String password;

    /**
    * 昵称
    */
    private String nickName;

    /**
    * 性别，M-女，F-男，N-未知
    */
    private String gender;

    /**
    * 手机号
    */
    private String phone;

    /**
    * 邮箱
    */
    private String email;

    /**
     * 状态；0-正常，1-停用
     */
    private String status;

    /**
    * 头像
    */
    private String avatar;

    /**
    * 注册日期
    */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date registrationDate;

    /**
     * 角色id集合
     */
    @Column(ignore = true)
    private List<Long> roleIds;

}
